package com.graphqljava.demo.gql.config;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * com.graphqljava.demo.gql
 *
 * @author Oscar.Chen
 * @date 6/15/2020 3:52 PM
 */
@Component
public class RestServiceCorsApplication {
    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/graphql").allowedOrigins("*");
            }
        };
    }
}
